package com.ujoku.service.impl;

import com.labillusion.core.database.base.mybatis.dao.BaseDao;
import com.labillusion.core.database.base.mybatis.service.base.impl.BaseServiceImpl;
import com.ujoku.dao.AddressDao;
import com.ujoku.domain.Address;
import com.ujoku.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 14-10-25.
 */
@Service
public class AddressServiceImpl extends BaseServiceImpl<Address> implements AddressService<Address> {

    @Autowired
    private AddressDao dao;

    @Override
    protected BaseDao<Address> getBaseDao() {
        return this.dao;
    }

    @Override
    public List<Address> selectByMemberId(int memberId) {

        Map<String, Object> query  = new HashMap<String, Object>();
        query.put("memberId", memberId);
        return super.selectList(query);
    }

    @Override
    public Address selectById(String id, int memberId){
        Map<String, Object> query  = new HashMap<String, Object>();
        query.put("memberId", memberId);
        query.put("id", id);

        return super.selectOne(query);
    }

}
